package com.example.tests;

import static com.example.fw.RandomizeHelper.getRandomNumber;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;

import org.testng.annotations.Test;

import com.example.fw.Folders;

public class TestFolderDeletion extends TestBase
{

	@Test
	public void deleteSomeFolder()
	{
		Folders oldFolders = app.getFolderHelper().getFolders();

		if (oldFolders.size() > 0)
		{
			int index = getRandomNumber(0, oldFolders.size() - 1);
			/* cant organize deletion of anything but 0-th index folder */
			/* so some indian random :)*/
			index = 0;
			app.getFolderHelper().deleteFolder(index);

			Folders newFolders = app.getFolderHelper().getFolders();

			assertThat(newFolders, equalTo(oldFolders.without(index)));

		}
	}

}
